import { createI18n } from "vue-i18n";
import zh from "./zh.json";
import en from "./en.json";
import ja from "./ja.json";
import ko from "./ko.json";
import th from "./th.json";
import vi from "./vi.json";
import vantZhCN from 'vant/lib/locale/lang/zh-CN';
import vantEnUS from 'vant/lib/locale/lang/en-US';

import { localStorage } from "@/utils/local-storage";

const i18n: any = createI18n({
  locale: localStorage.get("lang") || "en",
  legacy: false,
  globalInjection: true,
  messages: {
    zh: {
      ...zh,
      ...vantZhCN
    },
    en: {
      ...en,
      ...vantEnUS
    },
    ja: {
      ...ja,
     },
     ko: {
      ...ko,
     },
     th: {
      ...th,
     },
     vi: {
      ...vi,
     },
  }
});

export { i18n };
